<?php
/**
 * 抽奖活动
 * User: cxm
 * Date: 2020/9/25
 * Time: 9:48
 */
Route::group(['prefix' => 'home','namespace' => 'Home'],function (){
    /**
     * 获取openid
     * 访问地址: POST: /api/home/getOpenid
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('getOpenid', ['uses' => 'LoginController@openid'])->name('api.home.getOpenid');

    /**
     * 用户注销
     * 访问地址: POST: /api/home/logout
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('logout', ['uses' => 'LoginController@logout'])->name('api.home.logout')->middleware('token');

    /**
     * 用户报名
     * 访问地址: POST: /api/home/userSign
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('userSign', ['uses' => 'LoginController@userSign'])->name('api.home.userSign');

    /**
     * 用户报名
     * 访问地址: POST: /api/home/userEnlist
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('userEnlist', ['uses' => 'LoginController@userEnlist'])->name('api.home.userEnlist');

    /**
     * 获取步数
     * 访问地址: POST: /api/home/steps
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('steps', ['uses' => 'LoginController@steps'])->name('api.home.steps')->middleware('token');

    /**
     * 微信获取手机
     * 访问地址: POST: /api/home/weixinMobile
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('weixinMobile', ['uses' => 'LoginController@weixinGetMobile'])->name('api.home.weixinMobile');

    /**
     * 根据手机匹配用户
     * 访问地址: POST: /api/home/getUserByMobile
     * 控制器位置: App\Admin\Controllers\Home\LoginController.php
     **/
    Route::post('getUserByMobile', ['uses' => 'LoginController@getUserByMobile'])->name('api.home.getUserByMobile');


    /**
     * 活动接口 不需要token验证
     */
    Route::group(['prefix' => 'activity'],function () {
        /**
         * 活动列表
         * 访问地址: POST: /api/home/activity/getLists
         * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
         **/
        Route::post('getLists', ['uses' => 'ActivityController@getList'])->name('api.home.activity.getLists');

        /**
         * 奖品列表
         * 访问地址: POST: /api/home/activity/goodsLists
         * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
         **/
        Route::post('goodsLists', ['uses' => 'ActivityController@goodsLists'])->name('api.home.activity.goodsLists');

        /**
         * 奖品详情
         * 访问地址: POST: /api/home/activity/goodsDetail
         * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
         **/
        Route::post('goodsDetail', ['uses' => 'ActivityController@goodsDetail'])->name('api.home.activity.goodsDetail');

        /**
         * 活动详情
         * 访问地址: POST: /api/home/activity/detail
         * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
         **/
        Route::post('detail', ['uses' => 'ActivityController@activityDetail'])->name('api.home.activity.detail');

    });


    // 用户登录权限
    Route::group(['middleware' => 'token'],function() {
        /**
         * 文章
         */
        Route::group(['prefix'=>'article'],function(){
            /**
             * 文章列表
             * 访问地址: POST: /api/home/article/getLists
             * 控制器位置: App\Admin\Controllers\Home\ArticleController.php
             **/
            Route::post('getLists', ['uses' => 'ArticleController@getLists'])->name('api.home.article.getLists');

            /**
             * 文章详情
             * 访问地址: POST: /api/home/article/show
             * 控制器位置: App\Admin\Controllers\Home\ArticleController.php
             **/
            Route::post('show', ['uses' => 'ArticleController@show'])->name('api.home.article.show');

        });
        // 抽奖活动
        Route::group(['prefix' => 'activity'],function () {
            /**
             * 用户信息
             * 访问地址: POST: /api/home/activity/userInfo
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('userInfo', ['uses' => 'ActivityController@userInfo'])->name('api.home.activity.userInfo');

            /**
             * 用户信息
             * 访问地址: POST: /api/home/activity/cardNoIsRight
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('cardNoIsRight', ['uses' => 'ActivityController@cardNoIsRight'])->name('api.home.activity.cardNoIsRight');

            /**
             * 用户抽奖次数
             * 访问地址: POST: /api/home/activity/userDrawNum
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('userDrawNum', ['uses' => 'ActivityController@userDrawNum'])->name('api.home.activity.userDrawNum');

            /**
             * 用户中奖列表
             * 访问地址: POST: /api/home/activity/userGetDraw
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('userGetDraw', ['uses' => 'ActivityController@userGetDraw'])->name('api.home.activity.userGetDraw');

            /**
             * 转盘--开始抽奖
             * 访问地址: POST: /api/home/activity/run
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('run', ['uses' => 'ActivityController@luckDraw'])->name('api.home.activity.run');

            /**
             * 填写领取奖品信息
             * 访问地址: POST:/api/home/activity/signDrawInfo
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('signDrawInfo', ['uses' => 'ActivityController@signDrawInfo'])->name('api.home.activity.signDrawInfo');

            /**
             * 中奖用户列表
             * 访问地址: POST:  /api/home/activity/winPrizeList
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('winPrizeList', ['uses' => 'ActivityController@winPrizeList'])->name('api.home.activity.winPrizeList');

            /**
             * 投诉建议
             * 访问地址: POST:  /api/home/activity/advise
             * 控制器位置: App\Admin\Controllers\Home\ActivityController.php
             **/
            Route::post('advise', ['uses' => 'ActivityController@advise'])->name('api.home.activity.advise');
        });

        /**
         * 邮储食堂
         */
        Route::group(['prefix'=>'foods'],function(){

            /**
             * 正式会员申请
             * 访问地址: POST: /api/home/foods/apply
             * 控制器位置: App\Admin\Controllers\Home\FoodsController.php
             **/
            Route::post('apply', ['uses' => 'FoodsController@apply'])->name('api.home.foods.apply');

        });

        /**
         * 答题抽奖
         */
        Route::group(['prefix'=>'question'],function(){
            /**
             * 获取题
             * 访问地址: POST: /api/home/question/getLists
             * 控制器位置: App\Admin\Controllers\Home\QuestionController.php
             **/
            Route::post('getLists', ['uses' => 'QuestionController@getQuestions'])->name('api.home.question.getLists');

            /**
             * 保存答案
             * 访问地址: POST: /api/home/question/saveAnswer
             * 控制器位置: App\Admin\Controllers\Home\QuestionController.php
             **/
            Route::post('saveAnswer', ['uses' => 'QuestionController@saveAnswer'])->name('api.home.question.saveAnswer');

            /**
             * 保存答案--全部
             * 访问地址: POST: /api/home/question/saveAllAnswer
             * 控制器位置: App\Admin\Controllers\Home\QuestionController.php
             **/
            Route::post('saveAllAnswer', ['uses' => 'QuestionController@saveAllAnswer'])->name('api.home.question.saveAllAnswer');

            /**
             * 答题是否通过（全对）
             * 访问地址: POST: /api/home/question/isRight
             * 控制器位置: App\Admin\Controllers\Home\QuestionController.php
             **/
            Route::post('isRight', ['uses' => 'QuestionController@isRight'])->name('api.home.question.isRight');

            /**
             * 是否可以参与抽奖
             * 访问地址: POST: /api/home/question/checkUserVie
             * 控制器位置: App\Admin\Controllers\Home\QuestionController.php
             **/
            Route::post('checkUserVie', ['uses' => 'QuestionController@checkUserVie'])->name('api.home.question.checkUserVie');
        });
    });
});

